import java.lang.reflect.Field;

public class PersonTest7 {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchFieldException {
        Class clz = Class.forName("reflect.entity.Person");
        Object person = clz.newInstance();

        Field name = clz.getDeclaredField("name");
        name.setAccessible(true);
        System.out.println("赋值前的name:"+name.get(person));
        name.set(person,"New Person");
        System.out.println("复制后的name"+name.get(person));
    }
}
